﻿@model PagedList.IPagedList<OMS.Models.OrderModelView>

@{
    ViewBag.Title = "Ordering";
}

<h2>Ordering</h2>

@Html.ActionLink("Create new Order", "AddOrder")
<div id="filter">
    @using (Html.BeginForm())
    {
        @Html.DropDownList("condition", new SelectList(new string[] {"created","ordered","pended","delivered"},ViewBag.Condition))
        @Html.DropDownList("field", new SelectList(new string[] {"ordername", "status"}, ViewBag.Field))
        @Html.TextBox("pattern")
        <input type="submit" value="Search" />
    }
</div>
<div>
<table align=center id="order_table">
    <tr>
        <th>Order Name</th>
        <th>Total Price</th>
        <th>Delivery Date</th>
        <th>Status</th>
        <th>Assignee</th>
        <th>Edit</th>
        <th>Delete</th>
    </tr>
    @foreach (var order in Model)
    {
        <tr>
            <td>@Html.DisplayFor(m => order.OrderNumber)</td>
            <td>@Html.DisplayFor(m => order.TotalPrice)</td>
            <td>@Html.DisplayFor(m => order.DeliveryDate)</td>
            <td>@Html.DisplayFor(m => order.Status)</td>
            <td>@Html.DisplayFor(m => order.AsigneeName)</td>
            <td>@Html.ActionLink("Edit","EditOrder",new {orderId = order.Id})</td>
            <td>@Html.ActionLink("Delete", "DeleteOrder", new { orderId = order.Id })</td>
        </tr>
    }
    </table>
</div>
